var article = document.getElementById('article');
var bottomArray = document.getElementsByClassName('cl');
console.log(bottomArray[0]);
//console.log(bottomArray);
var b = 0;
var h = ["yellow", 'blue', "purple", "red", 'black']
var a = ["蓝", "红", "黄", "紫", "黑"];
var fen1=fen.innerHTML;





//随机数
function shuiji(min, max) {
	return Math.floor(Math.random() * (max - min + 1) + min);
}
//大字
var daan;

function big() {
	var color = h[shuiji(0, 4)];
	article.style.color = color;
	article.innerHTML = a[shuiji(0, 4)];
	daan = color;
}
//setInterval(big,1000);
//打乱数组
function shuzu(arr) {
	console.log(arr.length);
	for(var i = 0; i < 20; i++) {
		var n = shuiji(0, 4);
		var m = shuiji(0, 4);
		if(n != m) {
			var a = arr[n];
			arr[n] = arr[m];
			arr[m] = a;
		}
	}
}
//小字
function xiao() {
	shuzu(a);
	shuzu(h);
	for(var i = 0; i < 5; i++) {
		bottomArray[i].innerHTML = a[i];
		bottomArray[i].style.color = h[i]
	}
	console.log(bottomArray);
}
xiao();
big();
var a4=30;
var a5= setInterval(function(){
	a4--;
	console.log(a4);
	if(a4<0){
		clearInterval(a5);
	}
}

	
,1000
)
for(var i = 0; i < 5; i++) {
	console.log(bottomArray[i].innerHTML);
	bottomArray[i].onclick = function() {
		console.log("-----------" + this.innerHTML);
		if(this.innerText ==  "黄" && daan == "yellow"){
			xiao();
			big();
			fen1++;
			console.log(fen1);
			fen.innerHTML=fen1;
			
		}else if(this.innerText == "红" && daan == "red"){
			xiao();
			big();
			fen1++;
			fen.innerHTML=fen1;
		}
		else if(this.innerText == "蓝" && daan == "blue") {
				xiao();
				big();	
				fen1++;
				fen.innerHTML=fen1;
			}
		else if(this.innerText == "黑" && daan == "black") {
				xiao();
				big();
				console.log("哈哈哈哈哈或")
				fen1++;
				fen.innerHTML=fen1;
			}
	  else	if(this.innerText == "紫" && daan == "purple") {
				xiao();
				big();
				fen1++;
				fen.innerHTML=fen1;
				console.log("哈哈哈哈哈或")
			}	
	}
}




